<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport"
    content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
  <title></title>
  <link rel="stylesheet" type="text/css" href="https://ad.aicebar.com/public/lib/css/style.css" />
  <script src="../assets/vue.min.js"></script>
  <style>
    :root {
      --var-btn-color: #fff;
    }

    .caifu img:nth-child(1) {
      width: 100%;
      height: 28.08rem;
    }

    .caifu img:nth-child(2) {
      width: 100%;
      height: 16.68rem;
    }

    .caifu img:nth-child(3) {
      width: 100%;
      height: 28.74rem;
    }

    .shiye img:nth-child(1) {
      width: 100%;
      height: 24.76rem;
    }

    .shiye img:nth-child(2) {
      width: 100%;
      height: 27.74rem;
    }

    .shiye img:nth-child(3) {
      width: 100%;
      height: 28.4rem;
    }

    .ganqing img:nth-child(1) {
      width: 100%;
      height: 16.8rem;
    }

    .ganqing img:nth-child(2) {
      width: 100%;
      height: 23.38rem;
    }

    .ganqing img:nth-child(3) {
      width: 100%;
      height: 25.42rem;
    }

    .nianyun img:nth-child(1) {
      width: 100%;
      height: 20.6rem;
    }

    .nianyun img:nth-child(2) {
      width: 100%;
      height: 33.86rem;
    }

    .nianyun img:nth-child(3) {
      width: 100%;
      height: 25.14rem;
    }

    .yunshi img:nth-child(1) {
      width: 100%;
      height: 14.98rem;
    }

    .yunshi img:nth-child(2) {
      width: 100%;
      height: 25.16rem;
    }

    .yunshi img:nth-child(3) {
      width: 100%;
      height: 13.24rem;
    }

    .flex {
      display: flex;
      flex-direction: row;
      align-items: center;
      justify-content: space-between;
      position: fixed;
      left: 50%;
      margin-left: -3.5rem;
      bottom: .8rem;
      width: 7rem;
    }

    .btn2 {
      width: 38%;
      height: .88rem;
      line-height: .88rem;
      border-radius: .44rem;
      text-align: center;
      font-size: .32rem;
      color: white;
      background: var(--var-btn-color);
      letter-spacing: 1px;
      font-weight: bold;
    }

    .btn {
      width: 60%;
      height: .88rem;
      line-height: .88rem;
      border-radius: .44rem;
      text-align: center;
      font-size: .32rem;
      color: white;
      background: var(--var-btn-color);
      letter-spacing: 1px;
      font-weight: bold;
    }

    .mask {
      width: 100%;
      height: 100%;
      background: white;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      position: fixed;
      left: 0;
      top: 0;
      font-size: .24rem;
      color: #666;
    }

    .mask img {
      width: .6rem;
      height: .6rem;
      margin-bottom: .1rem;
    }
  </style>
</head>

<body>
  <div id="app" v-cloak>
    <div class="mask" v-if="isShow">
      <img src="../images/loading.gif">
      <p>正在加载中...</p>
    </div>

    <div class="yunshi" v-if="type == 1">
      <img src="../images/ee (1).png">
      <img src="../images/ee (2).png">
      <img src="../images/ee (3).png">
    </div>
    <div class="caifu" v-if="type == 2">
      <img src="../images/bb (1).png">
      <img src="../images/bb (2).png">
      <img src="../images/bb (3).png">
    </div>

    <div class="shiye" v-if="type == 3">
      <img src="../images/cc (1).png">
      <img src="../images/cc (2).png">
      <img src="../images/cc (3).png">
    </div>
    <div class="ganqing" v-if="type == 4">
      <img src="../images/aa (1).png">
      <img src="../images/aa (2).png">
      <img src="../images/aa (3).png">
    </div>

    <div class="nianyun" v-if="type == 5">
      <img src="../images/dd (1).png">
      <img src="../images/dd (2).png">
      <img src="../images/dd (3).png">
    </div>

    <div class="flex">
      <div class="btn2" @click="btnShare">免费解读</div>
      <div class="btn" @click="btnBuy">立即购买 ¥{{obj.price}}</div>
    </div>

  </div>
</body>


<script src="https://ad.aicebar.com/public/lib/js/axios.js"></script>
<script src="../js/utils.js"></script>
<script>
  var api = domain()
  var json = getQueryString()

  try {
    appSetToken(json.apiToken)
  } catch (error) {

  }
  new Vue({
    el: '#app',
    data() {
      return {
        id: json.id,
        obj: '',
        type: '',
        isBuy: '',
        url: '',
        isShow: true
      }
    },
    mounted() {
      this.getData()
    },
    methods: {
      btnBuy() {
        window.location.href = './pay.html?id=' + this.id
      },
      btnShare() {
        window.location.href = './share.html?type=' + this.type + '&id=' + this.id
      },
      async getData() {
        var data = new FormData();
        data.append('id', this.id);
        const headers = {
          'authorization': getAppToken()
        }
        axios.post(api + '/v1/product/detail', data, {
          headers
        })
          .then((res) => {
            var res = res.data.data
            this.obj = res
            this.type = res.pro_type_sim
            if (res.is_buy == 1) {
              const ress = switchUrl(this.type, this.id, res.order_no)
              if (ress) {
                this.isShow = false
              }
            } else {
              handleType(this.type)
              this.isShow = false
            }

          })
      },


    }
  });
</script>

</html>